@model GenDbTableDto
@{
    var className = Model.EntityName;
    var classNameRemark = Model.DisplayName;

    var ignores = new string[] {
        "Id",
        "CreationTime",
        "CreatorUserId",
        "LastModificationTime",
        "LastModifierUserId" ,
        "DeletionTime",
        "DeleterUserId",
        "IsDeleted",
        "id",
        "creation_time",
        "creator_user_id",
        "last_modification_time",
        "last_modifier_user_id" ,
        "deletion_time",
        "deleter_user_id",
        "is_deleted",
    };

    var tableInfos = Model.TableInfos
        .Where(w => !ignores.Contains(w.ColumnName))
        .OrderBy(w => w.Position)
        .ToList()
        ;
}

@functions
{
    //获取类型 根据 appTableInfo
    string GetType(DbColumnInfo appTableInfo)
    {
        switch (appTableInfo.DbTypeText)
        {
            case "uniqueidentifier":
                return appTableInfo.IsPrimary ? "Guid" : "Guid?";
            case "bit":
            case "int":
                return appTableInfo.IsPrimary ? "int" : "int?";
            case "datetime":
                return appTableInfo.IsNullable ? "DateTime?" : "DateTime";
            case "float":
            case "money":
                return appTableInfo.IsNullable ? "double?" : "double";
            case "decimal":
                return appTableInfo.IsNullable ? "decimal?" : "decimal";
            default:
                return appTableInfo.IsNullable ? appTableInfo.CsType.Name + "?" : appTableInfo.CsType.Name;
        }
    }

    /// <summary>
    /// 获取类型 根据 appTableInfo
    /// </summary>
    /// <param name="appTableInfo"></param>
    /// <returns></returns>
    string GetTypeNew(LowCodeTableInfo appTableInfo)
    {
        if (appTableInfo.CsType.ToLower() == "string")
        {
            return "string?";
        }

        return appTableInfo.IsNullable ? $"{appTableInfo.CsType}?" : appTableInfo.CsType;
    }

    /// <summary>
    /// 获取 id 组件所对应的类型
    /// </summary>
    /// <returns></returns>
    string GetIdType()
    {
        var lowCodeTableInfo = Model.TableInfos.Where(w => w.ColumnName == "Id")?.FirstOrDefault();

        if (lowCodeTableInfo == null) return "DefaultEntity";

        if (lowCodeTableInfo.CsType.ToLower().Contains("string"))
            return "DefaultEntityStringKey";

        if (lowCodeTableInfo.CsType.ToLower().Contains("int"))
            return "DefaultEntityIdentityIntKey";

        if (lowCodeTableInfo.CsType.ToLower().Contains("guid"))
            return "DefaultEntity";

        return "DefaultEntity<" + lowCodeTableInfo.CsType + ">";
    }


}

<pre>
namespace @(Model.Namespace).Repository.EntityFramework.Admin.Entities.Apps;

/// <summary>
/// @(string.IsNullOrWhiteSpace(classNameRemark) ? className : classNameRemark)
/// </summary>
public class @className : @(GetIdType())
{

    @foreach (var item in tableInfos)
    {
    <pre>
    /// <summary>
    ///  @(string.IsNullOrWhiteSpace(item.DisplayName) ? item.ColumnName : item.DisplayName) => 备注: @(string.IsNullOrWhiteSpace(item.Describe) ? item.ColumnName : item.Describe)
    /// </summary>
    public @(GetTypeNew(item)) @item.ColumnName { get; set; }
    </pre>
    }

}

</pre>